/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.domain;

import java.util.Vector;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Miguel
 */
public class BeberageTableModel extends DefaultTableModel{
    
    public void addBeberageToTable(Beberage beberage){
        Vector vector = new Vector();
        vector.add(beberage.getID());
        vector.add(beberage.getName());
        vector.add(beberage.getDescription());
        addRow(vector);
    }
    
    @Override
    public boolean isCellEditable(int row, int column) {
        return false;
    }
    
    public Beberage getBeberageAt(int index){
        Beberage beberage = new Beberage();
        int beberageID = (Integer)getValueAt(index,0);
        beberage.setID(beberageID);
        String beberageName = (String)getValueAt(index,1);
        beberage.setName(beberageName);
        String beberageDescription = (String)getValueAt(index,2);
        beberage.setDescription(beberageDescription);
        return beberage;
    }
}
